/*     */ package com.lmpop.trade.ti_emailaddrs;
/*     */ 
/*     */ import com.lmpop.frame.QueryList;
/*     */ import com.lmpop.frame.SysMap;
/*     */ import com.lmpop.frame.TradeInterf;
/*     */ import com.lmpop.frame.dao.DbmInterf;
/*     */ import com.lmpop.frame.exp.ApplicationException;
/*     */ import com.lmpop.frame.util.RandomID;
/*     */ import java.io.PrintStream;
/*     */ import java.util.Hashtable;
/*     */ import java.util.List;
/*     */ import java.util.Map;
/*     */ import java.util.StringTokenizer;
/*     */ 
/*     */ public class Ti_emailaddrsInfo
/*     */   implements TradeInterf
/*     */ {
/*     */   QueryList queryList;
/*     */ 
/*     */   public Ti_emailaddrsInfo()
/*     */   {
/*  17 */     this.queryList = new QueryList();
/*     */   }
/*     */ 
/*     */   public SysMap insert(DbmInterf dbmMgr, SysMap map)
/*     */   {
/*  26 */     Ti_emailaddrs ti_emailaddrs = new Ti_emailaddrs();
/*  27 */     RandomID randomID = new RandomID();
/*  28 */     String all_emails = map.getString("email");
/*  29 */     String result_code = "0";
/*     */     try
/*     */     {
/*  32 */       StringTokenizer all_email = new StringTokenizer(all_emails, "|");
/*  33 */       String email_addr = "";
/*  34 */       while (all_email.hasMoreTokens()) {
/*  35 */         String trade_id = "";
/*     */ 
/*  37 */         ti_emailaddrs.setSend_id(map.getString("send_id"));
/*  38 */         ti_emailaddrs.setSend_state(map.getString("send_state"));
/*     */ 
/*  40 */         ti_emailaddrs.setStart_date(map.getString("pre_date"));
/*  41 */         ti_emailaddrs.setEnd_date(map.getString("pre_date"));
/*     */ 
/*  43 */         ti_emailaddrs.setSort_no(1);
/*     */ 
/*  45 */         trade_id = randomID.GenTradeId();
/*  46 */         ti_emailaddrs.setTrade_id(trade_id);
/*  47 */         email_addr = all_email.nextToken();
/*     */ 
/*  49 */         ti_emailaddrs.setEmail(email_addr);
/*  50 */         insert(dbmMgr, ti_emailaddrs);
/*     */       }
/*     */     }
/*     */     catch (ApplicationException e) {
/*  54 */       e.printStackTrace();
/*  55 */       result_code = "1";
/*     */     }
/*  57 */     map.setString("result_code", result_code);
/*  58 */     return map;
/*     */   }
/*     */ 
/*     */   public void insert(DbmInterf dbmMgr, Ti_emailaddrs ti_emailaddrs)
/*     */     throws ApplicationException
/*     */   {
/*  67 */     dbmMgr.update("insertTi_emailaddrs", ti_emailaddrs);
/*     */   }
/*     */ 
/*     */   public SysMap delete(DbmInterf dbmMgr, SysMap map)
/*     */   {
/*  77 */     String pkid_string = map.getString("pkid");
/*  78 */     String result_code = "0";
/*     */     try {
/*  80 */       if (!pkid_string.equals("")) {
/*  81 */         String[] pkStr = pkid_string.split("\\|");
/*  82 */         for (int i = 0; i < pkStr.length; i++) {
/*  83 */           System.out.println("---------->" + pkStr[i]);
/*  84 */           if (pkStr[i].equals("")) continue; delete(dbmMgr, pkStr[i]);
/*     */         }
/*     */       }
/*     */     } catch (ApplicationException e) {
/*  88 */       e.printStackTrace();
/*  89 */       result_code = "1";
/*     */     }
/*  91 */     map.setString("result_code", result_code);
/*  92 */     return map;
/*     */   }
/*     */ 
/*     */   public void delete(DbmInterf dbmMgr, String pkid)
/*     */     throws ApplicationException
/*     */   {
/* 101 */     dbmMgr.update("deleteTi_emailaddrs", pkid);
/*     */   }
/*     */ 
/*     */   public SysMap update(DbmInterf dbmMgr, SysMap map)
/*     */   {
/* 111 */     String result_code = "0";
/*     */     try {
/* 113 */       delete(dbmMgr, map.getString("send_id"));
/*     */ 
/* 115 */       insert(dbmMgr, map);
/*     */     } catch (ApplicationException e) {
/* 117 */       e.printStackTrace();
/* 118 */       result_code = "1";
/*     */     }
/* 120 */     map.setString("result_code", result_code);
/* 121 */     return map;
/*     */   }
/*     */ 
/*     */   public void update(DbmInterf dbmMgr, Ti_emailaddrs ti_emailaddrs)
/*     */     throws ApplicationException
/*     */   {
/* 130 */     dbmMgr.update("updateTi_emailaddrs", ti_emailaddrs);
/*     */   }
/*     */ 
/*     */   public List getListByPage(Object obj, int start, int limit)
/*     */   {
/* 140 */     Ti_emailaddrs ti_emailaddrs = (Ti_emailaddrs)obj;
/* 141 */     Map params = new Hashtable();
/* 142 */     if (start == 0)
/* 143 */       start = 0;
/*     */     else {
/* 145 */       start = (start - 1) * limit;
/*     */     }
/* 147 */     params.put("start", Integer.valueOf(start));
/* 148 */     params.put("limit", Integer.valueOf(limit));
/* 149 */     return this.queryList.getList("getTi_emailaddrsList", params);
/*     */   }
/*     */ 
/*     */   public int getCountByObj(Object obj)
/*     */   {
/* 160 */     Ti_emailaddrs ti_emailaddrs = (Ti_emailaddrs)obj;
/* 161 */     List list = this.queryList.getList("getCountByObjTi_custlink", ti_emailaddrs);
/* 162 */     int count = 0;
/* 163 */     if ((list != null) && (list.size() > 0)) {
/* 164 */       Hashtable newsMap = (Hashtable)list.get(0);
/* 165 */       if ((newsMap.get("count") != null) && (!newsMap.get("count").toString().equals(""))) {
/* 166 */         count = Integer.parseInt(newsMap.get("count").toString());
/*     */       }
/*     */     }
/* 169 */     return count;
/*     */   }
/*     */ 
/*     */   public List getListByPk(String pk)
/*     */   {
/* 179 */     return this.queryList.getList("getTi_emailaddrsByPk", pk);
/*     */   }
/*     */ 
/*     */   public List getEmailListBySendID(String sendID)
/*     */   {
/* 188 */     return this.queryList.getList("getEmailListBySendID", sendID);
/*     */   }
/*     */ }

/* Location:           F:\电商\commons-utils.jar
 * Qualified Name:     com.lmpop.trade.ti_emailaddrs.Ti_emailaddrsInfo
 * JD-Core Version:    0.6.0
 */